package com.waymap.utils;

import lombok.AllArgsConstructor;
import lombok.Getter;

/***
 * Created by tim on 2017/7/8.
 * 常用枚举类
 *
 */
@Getter
@AllArgsConstructor
public enum CommonEnum {
    /**
     * 成功200
     */
    eSuccess("eSuccess","200"),

    eSMessage("eSMessage","查询成功"),

    /**
     * 数据更新失败
     */
    eFail("eFail","401"),
    eFailMessage("eFailMessage","数据更新失败"),

    /**
     * 未找到
     */
    eNotFind("eNotFind","400"),
    notFind("notFind","未找到");






    /**
     * key值
     */
    private String key;
    /**
     * 键值
     */
    private String value;

    /**
     * 根据key获取值
     * @param key key
     * @return value
     */
    public static String value(String key){
        for(CommonEnum c : CommonEnum.values()){
            if (c.getKey().equals(key)){
                return c.getValue();
            }
        }
        return notFind.getValue();
    }



}
